import request from "@/plugins/service";

function findAllByDatabaseId(id) {
  return request({
    url: '/database/' + id + '/tables',
    method: 'GET'
  })
}

function findAllJdbcTableByDatabaseId(id) {
  return request({
    url: '/database/' + id + '/jdbcTables',
    method: 'GET'
  })
}

function importFromJdbc(data) {
  return request({
    url: '/database/table/import',
    method: 'POST',
    data
  })
}


function deleteOne(id) {
  return request({
    url: '/database/table/' + id,
    method: 'DELETE'
  })
}

function saveOne(data) {
  return request({
    url: '/database/table/',
    method: 'PUT',
    data
  })
}

export default {
  findAllByDatabaseId,
  deleteOne,
  importFromJdbc,
  findAllJdbcTableByDatabaseId,
  saveOne,
}

